<template>
    <div class="admin-list">
        <!-- 管理员列表 -->

        <el-table :data="list">
            <el-table-column label="编号" prop="adminid"></el-table-column>
            <el-table-column label="管理员名称" prop="adminname"></el-table-column>
            <el-table-column label="管理员等级" prop="role">
                <template v-slot="{row}">
                    <span v-if="row.role==1">超级管理员</span>
                    <span v-if="row.role==2">普通管理员</span>
                    <span v-if="row.role==0">普通用户</span>
                </template>
            </el-table-column>
            <el-table-column label="权限" prop="checkedKeys">
                <template v-slot="{row}">
                    <p v-for="(item,index) in row.checkedKeys" :key="index">{{ item }}</p>
                </template>
            </el-table-column>
            <el-table-column label="权限" prop="checkedKeys">
                <template v-slot="">
                    <el-button type="primary" size="small" > 删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    import { getAdminListAPI } from '@/api/admin';
    export default {
        name:"AdminListView",
        data(){
            return {
                list:[],
                a:1,
            }
        },
        methods:{
            async getAdminList(){
                try {
                    var res = await getAdminListAPI();
                    console.log("管理员列表",res);
                    this.list = res.data;
                } catch (error) {
                    this.$message.error(error.message)
                }
            }
        },
        mounted(){
            this.getAdminList();
        }
    }
</script>

<style lang="scss" scoped>

</style>